﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using QLACQUY.DTO;
using QLACQUY.BUS;
namespace QLACQUY
{
    public partial class ThemQuyCach : Form
    {
        public ThemQuyCach()
        {
            InitializeComponent();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Dispose();
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            if (txtTenQuyCach.Text !="")
            {                
                QuyCachDTO dto = new QuyCachDTO();
                dto.QuyCach = txtTenQuyCach.Text;
                QuyCachBUS bus = new QuyCachBUS();
                int kq = bus.themQuyCach(dto);
                if (kq <= 0)
                {
                    MessageBox.Show("Tên quy cách này đã tồn tại!");
                    return;
                }
                this.Dispose();
            }
        }
    }
}
